<template>
  <div>
    <template v-if="type">
      <table>
            <tr><th v-for="(value, index) in list" :key="index">{{value.head}}</th></tr>
            <tr v-for="(value, index) in list[0].itemList" :key="index">
                <td :class="{'active':val.itemList[index]?val.itemList[index].exist:'','do':val.itemList[index]}" v-for="(val, ind) in list" :key="ind" @click="tdpush(ind,index)" :title="val.itemList[index]?val.head+' '+val.itemList[index].name:''">
                    <div class="dl" ><span :class="{'num':typeof(val.itemList[index]?val.itemList[index].name:'')=='number'}">{{val.itemList[index]?val.itemList[index].name:''}}</span></div>
                    <div class="dl td-div">{{val.itemList[index]?val.itemList[index].odds:''}}</div>
                </td> 
            </tr>
      </table>
      <div class="sum">
          金额
          <input type="text" class="amount" v-model="sum"/>
          <input type="button" class="sure"  value="确定" @click="submit('1')"/>
          <input type="button" class="rest" value="重置" @click="sumClear" />
      </div>
    </template>
    <template v-else>
        <table>
            <tr><th v-for="(value, index) in list" :key="index">{{value.head}}</th></tr>
            <tr v-for="(value, index) in list[0].itemList" :key="index">
                <td v-for="(val, ind) in list" :key="ind" :title="val.itemList[index]?val.head+' '+val.itemList[index].name:''">
                    <div class="dd" ><span :class="{'num':typeof(val.itemList[index]?val.itemList[index].name:'')=='number'}">{{val.itemList[index]?val.itemList[index].name:''}}</span></div>
                    <div class="dd td-div">{{val.itemList[index]?val.itemList[index].odds:''}}</div>
                    <div class="dd td-input"><input type="number" min="1" v-if="val.itemList[index]" v-model="val.itemList[index].exist"></div>
                </td> 
            </tr>
        </table>
        <div class="sum">
          总金额
          <input type="text" class="amount" v-model="total"/>
          <input type="button" class="sure"  value="确定" @click="submit('2')"/>
          <input type="button" class="rest" value="重置" @click="sumClear" />
      </div>
    </template>
  </div>
</template>

<script>
export default {
  name: 'gametable',
  data () {
    return {
    }
  },
  props:['itemd'],
  methods:{
  }
}
</script>

<style lang="scss">
</style>
